package com.rush.manageepac.controller;

import com.rush.manageepac.entity.Register;
import com.rush.manageepac.service.intf.RegisterService;
import com.rush.manageepac.vo.PageBean;
import com.rush.manageepac.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @outhor mjh
 * @date 2022/8/29
 */
@RestController
@RequestMapping("/api/register/")
public class RegisterController {
    @Autowired
    private RegisterService service;
    //新增
    @PostMapping("save.do")
    public R save(Register register){
        return service.save(register);
    }
    //修改
    @PostMapping ("update.do")
    public R update(Register register){
        return service.update(register);
    }
    //删除
    @GetMapping("del.do")
    public R del(int id){
        return service.delete(id);
    }
    //查询
    @GetMapping("page.do")
    public PageBean page(String name, int page, int limit){
        if (name==""){
            name=null;
        }
        return service.selectPage(name, page, limit);
    }
}
